"Organized by Fabio
if exists("b:__PHP_COND_XPT_VIM__")
  finish
endif
let b:__PHP_COND_XPT_VIM__ = 1

" containers
let [s:f, s:v] = XPTcontainer()

" ========================= Function and Variables =============================

call extend(s:v, { '$TRUE': 'TRUE'
                \, '$FALSE' : 'FALSE'
                \, '$NULL' : 'NULL'
                \, '$UNDEFINED' : ''
                \, '$INDENT_HELPER' : ''
                \, '$ELSESTYLE' : ' '
                \, '$BRACKETSTYLE' : ""})

" ================================= Snippets ===================================
XPTemplateDef

XPT if hint=if\ (..)\ {..}\ else...
if (`condition^) `$BRACKETSTYLE^{
  `_^
}`...^`$ELSESTYLE^elseif `$BRACKETSTYLE^{
  `__^
}`...^`$ELSESTYLE^`else...^else \`$BRACKETSTYLE\^{
  \`___\^ 
}^^

..XPT

XPT ifis hint=if\ (is...\ (..))\ {..}\ else...
if (`condition^conditionIs^) `$BRACKETSTYLE^{
  `_^
}`...^`$ELSESTYLE^elseif `$BRACKETSTYLE^{
  `__^
}`...^`$ELSESTYLE^`else...^else \`$BRACKETSTYLE\^{
  \`__\^ 
}^^

..XPT


XPT conditionIsSet
isset($`varName^)

XPT conditionIsArray
is_array($`varName^)

XPT conditionIsNull
is_null($`varName^)

XPT conditionIsEmpty
empty($`varName^)

XPT conditionIsDir
is_dir(`val^)

XPT conditionIsFile
is_file(`val^)

XPT conditionIsLink
is_link(`val^)

XPT conditionIsExecutable
is_executable(`val^)

XPT conditionIsWriteable
is_writeable(`val^)

XPT conditionIsDouble
is_double(`val^)

XPT conditionLessEqualThan
`var^ <= `of...^var ^

XPT conditionLessThan
`var^ <= `of...^var ^

XPT conditionGreaterEqualThan
`var^ >= `of...^var ^

XPT conditionGreaterThan
`var^ > `of...^var ^

XPT conditionEqual
`var^ == `of...^var ^

XPT conditionNotEqual
`var^ != `of...^var ^

XPT conditionIdentical
`var^ === `of...^var ^

XPT conditionNotIdentical
`var^ !== `of...^var ^

"===============================================
"DA rivedere il concetto per inserire or e and
XPT conditionsOr hint=(..)\ ||\ (..)
(`condition^) || (`condit^)

XPT conditionsAnd hint=(..)\ &&\ (..)
(`condition^) && (`condit^)
